<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace app\models;
/**
 * Description of UserForm
 *
 * @author Administrator
 * 
 */
use yii\base\Model;
class UserForm extends Model {

    //put your code here
    public $username;
    public $password;
    public $salt;
    public $gender;
    public $avatar;
    public $mobile;
    public $province;

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
           ['username', 'filter', 'filter' => 'trim'],
            ['username', 'required'],
            ['username', 'string', 'min' => 2, 'max' => 20],
            
            
            
            ['mobile', 'filter', 'filter' => 'trim'],
            ['mobile', 'required'],
            ['mobile', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'],
            ['mobile', 'string', 'length' => 11],
            
            ['password', 'required'],
            ['password', 'string', 'min' => 6,'max' => 20],
             ['avatar', 'required'],
             ['gender', 'required'],
             ['province', 'required'],
            
        ];
    }
}
